#!/usr/bin/expect

spawn build/bin/observer -f etc/observer.ini -P cli 
expect "miniob >"
send "drop table date_table\r"
expect "miniob >"
send "CREATE TABLE date_table(id int, u_date date);\r"
expect "miniob >"
send "CREATE INDEX index_id on date_table(u_date);\r"
expect "miniob >"
send "INSERT INTO date_table VALUES (1,'2020-01-21'),(2,'2020-10-21'),(5,'2020-10-21');\r"
expect "miniob >"
send "INSERT INTO date_table VALUES (2,'2020-10-21');\r"
expect "miniob >"
send "INSERT INTO date_table VALUES (3,'2020-1-01');\r"
expect "miniob >"
send "SELECT * FROM date_table WHERE u_date='2017-2-29';\r"
expect "miniob >"
send "INSERT INTO date_table VALUES (10,'2017-2-29');\r"
expect "miniob >"
send "UPDATE date_table SET u_date='2017-2-29' WHERE id=3\r"
expect "miniob >"
send "INSERT INTO date_table VALUES (1,'2020-01-21'),(11,'2017-21-29');\r"
expect "miniob >"
send "select * from date_table\r"
expect "miniob >"
send "drop table insert_table\r"
expect "miniob >"
send "CREATE TABLE insert_table(id int, t_name char(4), col1 int, col2 int);\r"
expect "miniob >"
send "INSERT INTO insert_table VALUES (2,2,2);\r"
expect "miniob >"
send "INSERT INTO insert_table VALUES (4,'N4',1,1),(1,1,1);\r"
expect "miniob >"
send "INSERT INTO insert_table VALUES (4,'N4',1,1),(1,1,1,1);\r"
expect "miniob >"
send "select * from insert_table\r"
interact